#! /usr/bin/python

# Copyright (C) 2012 Zhan Zongru
# Author: Zhan Zongru
# Contact: zhan.zr@gmail.com
# License: New BSD License

import os,sys,subprocess

def dummy(self):
		print('testdummy')
		
def get_user_name():
	""" Construct a file name (time and question id).
	"""
	if os.name == 'posix':
		# cygwin , python 2.6
		p1 = subprocess.Popen('whoami', stdout=subprocess.PIPE)
		out1 = p1.communicate()[0]
		return out1.split('\n')[0]
	else:
		# win7, python 3.2
		p1 = subprocess.Popen('whoami', stdout=subprocess.PIPE)
		out1 = p1.communicate()[0]
		return out1.decode().split('\n')[0].split('\r')[0].split('\\')[-1]